home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 002 / chedit.arc / CGRAPHC.DOC < prev    next >
Text File  |  1986-07-23  |  26KB  |  716 lines

  1. This material is placed in the public domain by its author, William Couture.
  2. Copyright (c) 1986 by DDI.  All Rights Reserved.
  3.  
  4.  
  5.               CHARACTER GRAPHICS ROUTINES AVAILABLE
  6.  
  7. GENERAL NOTES:
  8.      All routines work in 320 x 200 4-color mode or 640 x 200 mode.
  9.      COLOR is an integer between 0 and 3, inclusive, for 320 x 200 mode,
  10.           and between 0 and 1, inclusive, for 640 x 200 mode (0 = background).
  11.           Adding 128 to the color will XOR draw the character instead of
  12.           plotting it.  This will allow you to place characters on top of
  13.           already drawn graphics screens without leaving holes in the picture.
  14.      All the regular graphics routines are also available.
  15.      CROW (Character ROW) is an integer between 1 and 25, inclusive.
  16.      CCOL (Character COL) is an integer between 1 and 40, inclusive, for
  17.           320 x 200 mode, and between 1 and 80 for 640 x 200 mode.
  18.      Do not let ANY routine draw anything beyond a screen edge.
  19.      Character graphics can only be displaed in the spaces where normal
  20.                characters would be on a 25 x 40 screen for 320 x 200 mode,
  21.                and in the spaces where charcters would be on a 25 x 80
  22.                screen for 640 x 200 mode.
  23.      WCHAR is an integer between 0 and 127, inclusive.  This is the index to
  24.                the desired graphics character.
  25.      CSHAPES is the name of an array which contains the character shapes.    
  26.  
  27.  
  28.  
  29.  
  30.  
  31. TYPE DEFINITIONS AND VARIABLES:
  32.      Type CHARSET is a 1024 element of unsigned char, which holds the character
  33.      images being used.  If your compiler does not support the "unsigned
  34.      char" type, make sure that the definition of char is an unsigned quantity.
  35.  
  36.      Type FILENAME is simply an 80 character array, used to pass a filename
  37.      to the readcset and writecset functtions.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. ROUTINES:
  48.  
  49. int readcset(cshapes,fname)
  50.    unsigned char *cshapes
  51.    char *fname
  52.  
  53.      Try to read the character set named filename into memory.  The routine
  54.      will return -1 if fname cannot be found, else it will return 0.
  55.      This procedure is provided as C source in the file CGRAPH.C.
  56.      
  57.      example:  errno = readcset(shapes,"myset.chr");
  58.                if (errno)
  59.                   puts("Error - character set not found.");
  60.                else
  61.                   run_program();
  62.  
  63.  
  64.  
  65.  
  66. int writecset(cshapes,fname)
  67.    unsigned char *cshapes
  68.    char *fname
  69.  
  70.      Write the current character set from memory to a disk file named fname.
  71.      The routine returns a -1 if the file cannot be created, else it returns
  72.      a 0.
  73.      This procedure is provided as C source in the file CGRAPH.C.
  74.      
  75.      
  76.      example:  errno = writecset(shapes,"c:\stuff\saved.chr");
  77.                if (errno)
  78.                   puts("Error - cannot open file to write character set.");
  79.                else
  80.                   puts("Character set saved.");
  81.  
  82.  
  83.  
  84. unsigned long getvect()
  85.  
  86.      Return the system's graphics character set pointer.  This allows you to
  87.      save the current pointer before setting up your own pointer.  The return
  88.      value is 32 bits, with the segment in the upper 16 bits and the offset in
  89.      the lower 16 bits.  It also has a companion routine, RESTOREVECT.
  90.  
  91.       example:  unsigned long hold;
  92.                 unsigned int seg,ofs;
  93.                 main()
  94.                    {
  95.                    hold = getvect();
  96.                    ofs = (unsigned int) hold & 0xffff;
  97.                    seg = (unsigned int) ((hold >> 16) & 0xffff);
  98.                    }
  99.  
  100.  
  101.  
  102. void restorevect(ofs,seg)
  103.    int ofs,seg.
  104.  
  105.      Restore a previous graphics character set pointer.
  106.  
  107.  
  108.  
  109. void setvect(cshapes)
  110.    unsigned char *cshapes
  111.  
  112.      Set the system to display your graphics character set.  This can be called
  113.      any number of times, to display differenct character sets.
  114.  
  115.  
  116.  
  117.  
  118.  
  119. void setbit(cshapes,wchar,row,col)
  120.    unsigned char *cshapes
  121.    int wchar,row,col
  122.                             row and col are integers from 0 to 7, inclusive
  123.      Set the bit at row,col in WCHAR to ON.
  124.  
  125.  
  126.  
  127. void clearbit(cshapes,wchar,row,col)
  128.    unsigned char *cshapes
  129.    int wchar,row,col
  130.                             row and col are integers from 0 to 7, inclusive
  131.      Set the bit at row,col in WCHAR to OFF.
  132.  
  133.  
  134.  
  135. void xorbit(cshapes,wchar,row,col)
  136.    unsigned char *cshapes
  137.    int wchar,row,col
  138.                             row and col are integers from 0 to 7, inclusive
  139.      Set the bit at row,col in WCHAR to the opposite of its current state.
  140.  
  141.  
  142.  
  143. void zerochar(cshapes,wchar)
  144.    unsigned char *cshapes
  145.    int wchar
  146.  
  147.      Set all bits in WCHAR to OFF.
  148.  
  149.  
  150.  
  151. void fillchar(cshapes,wchar)
  152.    unsigned char *cshapes
  153.    int wchar
  154.  
  155.      Set all bits in WCHAR to ON.
  156.  
  157.  
  158.  
  159. void inversechar(cshapes,wchar)
  160.    unsigned char *cshapes
  161.    int wchar
  162.  
  163.      Set all bits in WCHAR to the opposite of their current state.
  164.  
  165.  
  166.  
  167. void copychar(cshapes,fromchar,intochar)
  168.    unsigned char *cshapes
  169.    int fromchar,intochar
  170.                            fromchar and intochar are two examples of WCHAR
  171.      Make the graphics character intochar the same as fromchar.
  172.  
  173.  
  174.  
  175. void horizflip(cshapes,wchar)
  176.    unsigned char *cshapes
  177.    int wchar
  178.     
  179.      Mirror WCHAR about its horizontal axis.
  180.  
  181.  
  182.  
  183. void vertflip(cshapes,wchar)
  184.    unsigned char *cshapes
  185.    int wchar
  186.     
  187.  Mirror WCHAR about its vertical axis.
  188.  
  189.  
  190.  
  191. void exchangerc(cshapes,wchar)
  192.    unsigned char *cshapes
  193.    int wchar
  194.     
  195.      Exchange rows and columns in WCHAR.
  196.  
  197.  
  198.  
  199. void shiftdown(cshapes,wchar)
  200.    unsigned char *cshapes
  201.    int wchar
  202.     
  203.      Move the picture in WCHAR down 1 row.  The bottom row is lost and the
  204.      top row is set to blank.
  205.  
  206.  
  207.  
  208. void shiftup(cshapes,wchar)
  209.    unsigned char *cshapes
  210.    int wchar
  211.     
  212.      Move the picture in WCHAR up 1 row.  The top row is lost and the bottom
  213.      row is set to blank.
  214.  
  215.  
  216.  
  217. void shiftleft(cshapes,wchar)
  218.    unsigned char *cshapes
  219.    int wchar
  220.     
  221.      Move the picture in WCHAR left 1 column.  The left column is lost and
  222.      the right column is set to blank.
  223.  
  224.  
  225.  
  226. void shiftright(cshapes,wchar)
  227.    unsigned char *cshapes
  228.    int wchar
  229.     
  230.      Move the picture in WCHAR right 1 column.  The right column is lost and
  231.      the left column is set to blank.
  232.  
  233.  
  234.  
  235. void rotatedown(cshapes,wchar)
  236.    unsigned char *cshapes
  237.    int wchar
  238.     
  239.      Move the picture in WCHAR down 1 row.  The bottom row wraps into the top
  240.      row.
  241.  
  242.  
  243.  
  244. void rotateup(cshapes,wchar)
  245.    unsigned char *cshapes
  246.    int wchar
  247.     
  248.      Move the picture in WCHAR up 1 row.  The top row wraps into the bottom
  249.      row.
  250.  
  251.  
  252.  
  253. void rotateleft(cshapes,wchar)
  254.    unsigned char *cshapes
  255.    int wchar
  256.     
  257.      Move the picture in WCHAR left 1 column.  The left column wraps into
  258.      the right column.
  259.  
  260.  
  261.  
  262. void rotateright(cshapes,wchar)
  263.    unsigned char *cshapes
  264.    int wchar
  265.     
  266.      Move the picture in WCHAR right 1 column.  The right column wraps into
  267.      the left column.
  268.  
  269.  
  270.  
  271. void grchar(wchar,color)
  272.    int wchar,color
  273.                        color is an int from 0 to 3 in 320 x 200 mode, and
  274.                        from 0 to 1 in 640 x 200 mode
  275.      Plot the graphics char WCHAR at the current cursor position in COLOR.
  276.      Adding 128 (0x80 in hex) to the value of WCHAR will plot the
  277.      corresponding regular character, instead of the graphics character.
  278.      Adding 128 (0x80 in hex) to the color will XOR draw the character,
  279.      placing it on top of the current screen image.
  280.  
  281.  
  282.  
  283. void gratchar(crow,ccol,wchar,color)
  284.    int crow,ccol,wchar,color
  285.                        crow and ccol are the screen locations.  320 x 200
  286.                        mode supports a 40 x 25 screen, and 640 x 200 mode
  287.                        supports a 80 x 25 screen.
  288.                        color is an int from 0 to 3 in 320 x 200 mode, and
  289.                        from 0 to 1 in 640 x 200 mode.
  290.      Plot the graphics char WCHAR at CROW,CCOL in COLOR.
  291.      Adding 128 (0x80 in hex) to the value of WCHAR will plot the
  292.      corresponding regular character, instead of the graphics character.
  293.      Adding 128 (0x80 in hex) to the color will XOR draw the character,
  294.      placing it on top of the current screen image.
  295.  
  296.  
  297.  
  298. void printbanner(crow,ccol,msg,length,color)
  299.    int crow,ccol
  300.    int *msg
  301.    int length,color
  302.                        crow and ccol are the screen locations.  320 x 200
  303.                        mode supports a 40 x 25 screen, and 640 x 200 mode
  304.                        supports a 80 x 25 screen.
  305.                        MSG is an array of integers which contains the WCHAR
  306.                        codes for the banner
  307.                        LENGTH is the number of elements in MSG
  308.                        color is an int from 0 to 3 in 320 x 200 mode, and
  309.                        from 0 to 1 in 640 x 200 mode.
  310.      Move the cursor to CROW,CCOL and display the LENGTH graphics characters
  311.      from MSG across the screen in COLOR.  Please note that adding 128 (0x80
  312.      in hex) to the color will XOR draw the characters, placing them on top
  313.      of the current screen image.
  314.      This procedure is provided as C source in the file CGRAPH.C.
  315.      
  316.  
  317.  
  318.  
  319.  
  320. void bannerleft(cshapes,msg,length)
  321.    unsigned char *cshapes
  322.    int *msg
  323.    int length
  324.                        MSG is an array of integers which contains the WCHAR
  325.                        codes for the banner
  326.                        LENGTH is the number of elements in MSG
  327.      Treat LENGTH elements of MSG as one extended graphics character and
  328.      rotate it left 1 column.  The column rolled off the left is wrapped back
  329.      on the right.
  330.      
  331.  
  332.  
  333.  
  334. void bannerright(cshapes,msg,length)
  335.    unsigned char *cshapes
  336.    int *msg
  337.    int length
  338.                        MSG is an array of integers which contains the WCHAR
  339.                        codes for the banner
  340.                        LENGTH is the number of elements in MSG
  341.      Treat LENGTH elements of MSG as one extended graphics character and
  342.      rotate it right 1 column.  The column rolled off the right is wrapped back
  343.      to the left.
  344.  
  345.  
  346.  
  347. void bannerup(cshapes,msg,length)
  348.    unsigned char *cshapes
  349.    int *msg
  350.    int length
  351.                        MSG is an array of integers which contains the WCHAR
  352.                        codes for the banner
  353.                        LENGTH is the number of elements in MSG
  354.      Move LENGTH elements of MSG up 1 row.  The row rotated off the top
  355.      wraps back to the bottom.  Note that any character may be individually
  356.      scrolled via the rotatexxxx() procedures above.
  357.  
  358.  
  359.  
  360. void bannerdown(cshapes,msg,length)
  361.    unsigned char *cshapes
  362.    int *msg
  363.    int length
  364.                        MSG is an array of integers which contains the WCHAR
  365.                        codes for the banner
  366.                        LENGTH is the number of elements in MSG
  367.      Move LENGTH elements of MSG down 1 row.  The row rotated off the
  368.      bottom wraps back to the top.  Note that any character may be individually
  369.      scrolled via the rotatexxxx() functions above.
  370.  
  371.  
  372. example:
  373.  
  374. /*
  375.    Example program #1 from the CGRAPH documentation.
  376. */
  377. /*
  378.    Compile this with your compiler, then Link it with the supplied object
  379.    modules.
  380. */
  381. #include <stdio.h>
  382. #include <chedit.h>     /* Defines of the CHEDIT functions.  Use it if your
  383.                            compiler does strong type checking. */
  384. #include <cgraph.c>     /* The READCSET, WRITECSET, PRINTBANNER, and
  385.                            PRINTCOLUMN routines are C source, included in
  386.                            this file. */
  387. #define CYAN    1
  388. #define MAGENTA 2 
  389. #define WHITE   3       /* color definitions */
  390.  
  391. unsigned char shapes[1024];  /* the array to hold the character shapes */
  392. int message[20];             /* the array to hold the message to be plotted */
  393. int errno;                   /* to hold the return value from READCSET */
  394. int i,m;                     /* loop indices */
  395. unsigned long hold;          /* temporary storage for saving the system
  396.                                 graphics character vector */
  397. unsigned int ofs,seg;        /* the ofset and segment of the saved system
  398.                                 vector */
  399.  
  400. main()
  401.    {
  402.    errno = readcset(shapes,"alpha.chr");
  403.                                /* read the character set */
  404.    if (!errno)                 /* if all ok */
  405.       {
  406.       grmode(4);            /* set to 320 x 200 graphics */
  407.                             /* Use the routine appropriate to your compiler */
  408.       message[0] = 65;      /* graphics character 65 */
  409.       message[1] = 67;      /* etc. */
  410.       message[2] = 69;
  411.       hold = getvect();     /* save the system vector */
  412.       ofs = (unsigned int) (hold & 0xffff);
  413.       seg = (unsigned int) ((hold >> 16) & 0xffff);
  414.       setvect(shapes);      /* and insert our own */
  415.       printbanner(2,5,message,2,CYAN);
  416.                          /* print the message in color 1, cyan, at 2,5
  417.                             on the screen. Note that this displays only
  418.                             the first 2 characters, so the 3rd is "hidden" */
  419.       for (i = 0; i < 8*3*20; i++)
  420.                             /* rotate through all 8 columns of the 3 chars
  421.                                20 times */
  422.          {
  423.          for (m = 0; m < 1500; m++)  ;
  424.                            /* waste a little time */
  425.          bannerleft(shapes,message,3);
  426.                            /* rotate all left so all characters take turns
  427.                               being hidden */
  428.          printbanner(2,5,message,2,CYAN);
  429.                            /* and display it again */
  430.          }
  431.       for (m = 0; m < 30000; m++) ;
  432.                             /* one last time delay */
  433.       restorevect(ofs,seg); /* put the system vector back */
  434.       grmode(3);            /* turn the graphics off */
  435.                             /* use the routine appropriate to your compiler */
  436.       }                     /* end of the if */
  437.    }                        /* end of the program */
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446. void printcolumn(crow,ccol,msg,length,color)
  447.    int crow,ccol
  448.    int *msg
  449.    int length,color
  450.                        crow and ccol are the screen locations.  320 x 200
  451.                        mode supports a 40 x 25 screen, and 640 x 200 mode
  452.                        supports a 80 x 25 screen.
  453.                        MSG is an array of integers which contains the WCHAR
  454.                        codes for the banner
  455.                        LENGTH is the number of elements in MSG
  456.                        color is an int from 0 to 3 in 320 x 200 mode, and
  457.                        from 0 to 1 in 640 x 200 mode.
  458.      Move the cursor to CROW,CCOL and display the LENGTH graphics chatacters
  459.      from MSG down the screen in COLOR.  Please note that adding 128 (0x80
  460.      in hex) to the color will XOR draw the characters, placing them on top
  461.      of the current screen image.
  462.      This procedure is provided as C source in the file CGRAPH.C.
  463.  
  464.  
  465.  
  466. void columnup(cshapes,msg,length)
  467.    unsigned char *cshapes
  468.    int *msg
  469.    int length
  470.                        MSG is an array of integers which contains the WCHAR
  471.                        codes for the banner
  472.                        LENGTH is the number of elements in MSG
  473.      Treat LENGTH elements of MSG as one extended graphics character and
  474.      rotate it 1 row up.  The row that rolls off the top wraps to the bottom.
  475.  
  476.  
  477.  
  478. void columndown(cshapes,msg,length)
  479.    unsigned char *cshapes
  480.    int *msg
  481.    int length
  482.                        MSG is an array of integers which contains the WCHAR
  483.                        codes for the banner
  484.                        LENGTH is the number of elements in MSG
  485.      Treat LENGTH elements of MSG as on extended graphics character and
  486.      rotate it 1 row down.  The row that rolls off the bottom wraps to the top.
  487.  
  488.  
  489.  
  490. void columnleft(cshapes,msg,length)
  491.    unsigned char *cshapes
  492.    int *msg
  493.    int length
  494.                        MSG is an array of integers which contains the WCHAR
  495.                        codes for the banner
  496.                        LENGTH is the number of elements in MSG
  497.      Move LENGTH elements of MSG left 1 column.  The column rotated off the
  498.      left wraps to the right.  Note that any element of the column may be
  499.      scrolled by the rotatexxxx() functions above.
  500.  
  501.  
  502.  
  503. void columnright(cshapes,msg,length)
  504.    unsigned char *cshapes
  505.    int *msg
  506.    int length
  507.                        MSG is an array of integers which contains the WCHAR
  508.                        codes for the banner
  509.                        LENGTH is the number of elements in MSG
  510.      Move LENGTH elements of MSG right 1 column.  The column rotated off
  511.      the right wraps to the left.  Note that any element of the column may be
  512.      scrolled by the rotatexxxx() functions above.
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519. example:
  520.  
  521. /*
  522.    Example program #2 from the CGRAPH documentation.
  523. */
  524. /*
  525.    Compile this with your compiler, then Link it with the supplied object
  526.    modules.
  527. */
  528. #include <stdio.h>
  529. #include <chedit.h>     /* Defines of the CHEDIT functions.  Use it if your
  530.                            compiler does strong type checking. */
  531. #include <cgraph.c>     /* The READCSET, WRITECSET, PRINTBANNER, and
  532.                            PRINTCOLUMN routines are C source, included in
  533.                            this file. */
  534. #define CYAN    1
  535. #define MAGENTA 2 
  536. #define WHITE   3       /* color definitions */
  537.  
  538. unsigned char shapes[1024];   /* character set storage */
  539. int window1[6],window2[6],window3[6];
  540.                               /* the character "strings" to be displayed */
  541. int i,m,n,p,errno,delay,delta;
  542.                               /* loop indices and such */
  543. char ch;                      /* for user response */
  544.  
  545. unsigned long hold;           /* temporary storage for saving the system
  546.                                  graphics character vector */
  547. unsigned int ofs,seg;         /* the ofset and segment of the saved system
  548.                                  vector */
  549.  
  550. main()
  551.    {
  552.    errno = readcset(shapes,"slotmchn.chr");
  553.                              /* read the character set */
  554.    if (!errno)               /* if all is ok */
  555.       {
  556.       grmode(4);          /* set 320 x 200 graphics */
  557.                           /* use the routine appropriate to your compiler */
  558.       cursor_pos(20,3);   /* use the routine appropriate to your compiler */
  559.       puts("Press Return to roll again");
  560.                           /* let the user know what to do */
  561.       hold = getvect();   /* save the system vector */
  562.       ofs = (unsigned int) (hold & 0xffff);
  563.       seg = (unsigned int) ((hold >> 16) & 0xffff);
  564.       setvect(shapes);    /* and put in our own */
  565.       for (i = 0; i < 5; i++)  /* set up the bells and whistles (and cherries */
  566.          {                     /* and lemons and...) */
  567.          window1[i] = i;   /* use these characters */
  568.          window2[i] = i+10;
  569.          window3[i] = i+20;
  570.          }
  571.       for (i = 0; i < 5; i++)
  572.          {
  573.          copychar(shapes,window1[i],window2[i]);
  574.                        /* copy the pictures from window1 to window 2 */
  575.          copychar(shapes,window1[i],window3[i]);
  576.                        /* and window 3 */
  577.          }
  578.       do               /* now do the display */
  579.          {
  580.          i = 8*((rand() % 11)+5);
  581.                           /* spin window 1 5 to 15 times (8 rows/char) */
  582.          m = i+8*((rand() % 6)+5);
  583.                           /* window 2 spins a little longer */
  584.          n = m+8*((rand() % 6)+5);
  585.                           /* and window 3 longer yet */
  586.          printcolumn(5,10,window1,1,WHITE);
  587.                           /* display the initial characters */
  588.          printcolumn(5,15,window2,1,WHITE);
  589.          printcolumn(5,20,window3,1,WHITE);
  590.                           /* Note: for displaying 1 character, gratchar */
  591.                           /* could also be used. */
  592.                           /* e.g. gratchar(5,x,windowx[0],WHITE) */
  593.          delay = 0;       /* start off fast */
  594.          do
  595.             {
  596.             if (i)        /* each window rolls its own number of times */
  597.                {
  598.                columndown(shapes,window1,5);  /* roll window */
  599.                i--;       /* count it */
  600.                if (i == 0)
  601.                   delay += 50;
  602.                            /* if this window is not going to roll */
  603.                            /* anymore, make up for the processing */
  604.                            /* time lost not updating it */
  605.                }
  606.             if (m)        /* this looks just like the previous one */
  607.                {
  608.                columndown(shapes,window2,5);
  609.                m--;
  610.                if (m == 0)
  611.                   delay += 50;
  612.                }
  613.             columndown(shapes,window3,5);
  614.             n--;     /* the 3rd window needs no fancy processing, as we
  615.                         know it will be spinning to the very end */
  616.             for (delta = 0; delta < delay; delta++);  /* waste a little time */
  617.             delay += 10;    /* waste a little more time next time */
  618.             printcolumn(5,10,window1,1,WHITE);  /* update the windows */
  619.             printcolumn(5,15,window2,1,WHITE);
  620.             printcolumn(5,20,window3,1,WHITE);
  621.             } while (n);       /* end of inner repeat loop */
  622.          ch = getchar();    /* get the users response */
  623.                             /* anything fancier would be compiler dependent */
  624.          } while (ch == '\n');  /* and repeat until it is not a CR */
  625.       restorevect(ofs,seg);     /* put the system vector back */
  626.       grmode(3);            /* restore the regular screen */
  627.       }                     /* end of the if statement */
  628.    }                        /* end of the program */
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636. void loadega(cshapes,num,size,offset)
  637.    unsigned char *cshapes
  638.    int num,size,offset
  639.  
  640.      Load the character set specified by CSHAPES as the resident EGA character
  641.      set.  NUM is the number of shapes to load into the character set (an
  642.      entire set need not be loaded at once), SIZE is the number of rows in
  643.      a character, and OFFSET is the location to start loading at (for example,
  644.      the offset to start loading at an upper case A is 65).  The loading
  645.      always starts at the 0th element of CSHAPES, so you cannot load a
  646.      character from the middle of a character set without loading the
  647.      characters that come before it.
  648.      It should be noted that loading ANY part of a character set, even if it
  649.      is not displayed on the screen (for example, loading the extended ASCII
  650.      characters), will re-calculate the number of rows on the screen, and set
  651.      the character size to the size specified.   Thus, if you load an 8 x 8
  652.      character set into the extended ASCII characters, the computer will
  653.      display the regular charcters as 8 x 8 as well, even though they have an
  654.      8 x 14 character set loaded.
  655.  
  656.  
  657. void loadega14(cshapes1,cshapes2,num,offset)
  658.    unsigned char *cshapes1,*cshapes2
  659.    int num,offset
  660.  
  661.      WARNING:  THIS ROUTINE IS A STACK HOG!
  662.                You will need at least 2K (2048 bytes) of AVAILABLE stack
  663.                to use this routine, and more is recommended to be on the
  664.                safe side!
  665.  
  666.      Take two CHEDIT character sets in the format described below, and load
  667.      them as the resident EGA character set in 8 x 14 format.  NUM is the
  668.      number of shapes to load into the character set (an entire set need not
  669.      be loaded at once, and OFFSET is the location to start loading at (for
  670.      example, the offset to start loading at an upper case A is 65).  The
  671.      loading always starts at the 0th element of CSHAPES1, so you cannot load
  672.      a character from the middle of a character seet without loading the
  673.      characters that come before it.
  674.      It should be noted that loading ANY part of a character set, even if it
  675.      is not displayed on the screen (for example, loading the extended ASCII
  676.      characters), will re-calculate the number of rows on the screen, and set
  677.      the character size to the size specified.   Thus, if you load an 8 x 14
  678.      character set into the extended ASCII characters, the computer will
  679.      display the regular charcters as 8 x 14 as well, even though they have an
  680.      8 x 8 character set loaded.
  681.      This function is provided as C source in the file EGA.C as an example.
  682.  
  683.      Please note that this is a "stopgap" function, included to provide
  684.      minimal support for EGA until an EGA version of CHEDIT is written.
  685.  
  686. CHARACTER SET FORMAT:
  687. The format of the two character sets is that each contains 64 characters that
  688. are two "standard" characters high (the bottom two rows should be unused in
  689. the second character), easily created via the Multiple character editing
  690. option of CHEDIT.  The characters must not be successive, but instead should
  691. be "on top" of each other as seen in the character set display at the top of
  692. CHEDIT.  i.e.
  693.  
  694.    _____________________________ ...
  695.   |        |        |        |
  696.   |  upper |  upper |  upper |
  697.   |    0   |    1   |    2   |    
  698.   |        |        |        |
  699.   |        |        |        |
  700.   |        |        |        |
  701.   |________|________|________|__ ...
  702.   |        |        |        |
  703.   |  lower |  lower |  lower |
  704.   |    0   |    1   |    2   |
  705.   |        |        |        |
  706.   |________|________|________|
  707.   |  blank |  blank |  blank |
  708.   |________|________|________|__ ...
  709.   |        |        |        |
  710.   .        .        .        .
  711.   .        .        .        .
  712.   .        .        .        .
  713.  
  714. The space labeled "blank" is the bottom 2 rows of the lower characters.  If
  715. are not blank, they will simply be ignored.
  716.